import { storage } from './../../../../../utils/storage'
/*
 * @Author: CQJ
 * @Date: 2022-08-25 20:00:27
 * @LastEditors: CQJ
 * @LastEditTime: 2022-09-05 00:29:58
 * @Description:
 */
import { reactive } from 'vue'

type Key = string
interface RoleState {
  // 全部状态
  role_status: number | undefined
  // 角色id
  role_id: string | undefined
  // 角色关键词
  role_keyword: string | undefined //角色名称关键词
  person_keyword: string | undefined //影人名称关键词
  site_id: string | undefined
}

// 角色状态管理
export const roleState = reactive<RoleState>({
  role_status: undefined,
  role_id: undefined,
  role_keyword: undefined,
  person_keyword: undefined,
  site_id: undefined
})

interface StatusState {
  isEdit: boolean
  addFilmMaker: boolean
  selectedRowKeys: Key[]
  checkFilmVisible: boolean
  checkMakerVisible: boolean
}
export const statusState = reactive<StatusState>({
  isEdit: false,
  addFilmMaker: false,
  selectedRowKeys: [],
  checkFilmVisible: false,
  checkMakerVisible: false
})
export const resetState = () => {
  let key: keyof RoleState
  for (key in roleState) {
    roleState[key] = undefined
  }
}
